package top.zy.page.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import top.zy.page.service.PageService;

import java.util.Map;

/**
 * @Author: HouZeYu
 * @Description:
 * @Date: Created in 20:53 2019/7/7
 */
@Controller
public class PageController {

    @Autowired
    @Qualifier("pageServiceImpl")
    private PageService pageService;

     @GetMapping("/item/{id}.html")
    public String  toItemPage(@PathVariable("id") Long spuId, Model model){
         Map<String,Object> attributes=pageService.loadData(spuId);
         model.addAllAttributes(attributes);
         return "item";
     }
}
